package com.zhenmyan.secdeal.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * description:
 *
 * @author 颜真明
 * @date 2023/5/15  9:50
 */
@Service
@Slf4j
public class MQDirectReceiver {

    private static final String DIRECT_QUEUE_1= "direct_queue_1";

    private static final String DIRECT_QUEUE_2 = "direct_queue_2";

    /**
     * 消息接收测试
     *
     * @param message
     */
    @RabbitListener(queues = DIRECT_QUEUE_1)
    public void receiveQueue1(String message) {
        System.out.println("Direct模式---->队列1接收消息，消息体："+message);
        log.info("Direct模式---->队列1接收消息：" + message);
    }

    /**
     * 消息接收测试
     *
     * @param message
     */
    @RabbitListener(queues = DIRECT_QUEUE_2)
    public void receiveQueue2(String message) {
        System.out.println("Direct模式---->队列2接收消息，消息体："+message);
        log.info("Direct模式---->队列2接收消息：" + message);
    }
}
